import { createStore } from "vuex";
import { getRouterList1 } from "@/http/common";

export default createStore({
  state: {
    routerList: [],
  },
  getters: {},
  mutations: {
    cgRouterList(state, data) {
      state.routerList = data;
    },
  },
  actions: {
    //获取路由链接
    async getRouter(context) {
      // @ts-ignore
      let ibj = JSON.parse(localStorage.getItem("userInfo"));
      const data:any = await getRouterList1(ibj.id);
      context.commit("cgRouterList", data.menu);
    },
  },
  modules: {},
});
